#include "osm-parsing.h"

void
parse_node_attrs(xmlTextReaderPtr r, struct node* n)
{
    int rc = xmlTextReaderMoveToFirstAttribute(r);

    while (rc == 1)
    {
        const xmlChar* name = xmlTextReaderConstName(r);
        const xmlChar* value = xmlTextReaderConstValue(r);

        if (xmlStrcmp("lat", name) == 0)
            n->lat = atof(value);
        else if (xmlStrcmp("lon", name) == 0)
            n->lon = atof(value);
        else if (xmlStrcmp("id", name) == 0)
            n->id = strtoul(value, NULL, 10);

        rc = xmlTextReaderMoveToNextAttribute(r);
    }
}

